package com.heima.common.snowflake;

import com.heima.utils.common.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class IdWorkerConfig {
    @Value("${leadnews.worker-id}")
    private Long workerId;
    @Value("${leadnews.datacenter-id}")
    private Long datacenterId;
    @Bean
    public SnowflakeIdWorker snowflakeIdWorker() {
        return new SnowflakeIdWorker(workerId, datacenterId);
    }
}